<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .back {
            width: 400px;
            height: 200px;
        }
        #sure {
            margin-left: 150px;
            background-color: rgb(192, 250, 255);
            border-radius: 50px;
            margin-top: 20px;
        }

        #yzm {
            background-color: chocolate;
        }

        #beauty {
            margin-left: 250px;
            border-radius: 20px;
            background-color: powderblue;
        }

        img {
            width: 400px;
        }

        #phone,
        #phone_code,
        #yzm{
            border-radius: 20px;
        }

    </style>
</head>

<body>
    <div class="back">
        <img src="https://tse4-mm.cn.bing.net/th/id/OIP-C.xGTInVTOkiPa4bx7tQWxzwHaEn?rs=1&pid=ImgDetMain" alt="">
        手机号：<input type="text" id="phone"><br>
        验证码：<input type="text" id="phone_code">
        <button id="yzm">发送验证码</button><br>
        <button id="sure">确认</button><br>
        <button id="bianji">编辑</button>
        <button id="beauty">点击美女带回家</button>
    </div>


    <script src="jquery-3.7.1.js"></script>
    <script>
        var time = 60
        $("#yzm").click(function () {
            $.ajax({
                url: "http://43.143.211.183:8889/sendSms/"+$("#phone").val(),
                type: "get",
                success: function (res) {
                    console.log(res);
                let dingshi=setInterval(() => { 
                time--
                $("#yzm").html(time)
                if (time == 0) {
                    clearInterval(dingshi)
                }
            }, 1000);
                }
            })
        })

        $("#sure").click(function () {
            $.ajax({
                url: "http://43.143.211.183:8889/login/h5/with-phone-code",
                type: "post",
                data:JSON.stringify ({
                    phone: $("#phone").val(),
                    phone_code: $("#phone_code").val(),
                    invite_code: ""

                }),
                contentType:"application/json",
                success: function (res) {
                    console.log(res.message);
                    if(code ==200){
                        alert("操作成功")
                    }else{
                        alert("操作失败")
                    }
                }
            })
        })
       
        $("#beauty").click(function () {
            alert("洗洗睡吧")
        })

    </script>
</body>

</html>